home *** CD-ROM | disk | FTP | other *** search
/ EnigmA Amiga Run 1997 February / EnigmA AMIGA RUN 15 (1997)(G.R. Edizioni)(IT)[!][issue 1997-02][PLANET CD V].iso / enigma / earcd / emula / arosdv19.lha / AROS / dos / format.c < prev    next >
C/C++ Source or Header  |  1996-10-24  |  2KB  |  101 lines

  1. /*
  2.     (C) 1995-96 AROS - The Amiga Replacement OS
  3.     $Id: format.c,v 1.3 1996/10/24 15:50:29 aros Exp $
  4.     $Log: format.c,v $
  5.     Revision 1.3  1996/10/24 15:50:29  aros
  6.     Use the official AROS macros over the __AROS versions.
  7.  
  8.     Revision 1.2  1996/09/13 17:50:07  digulla
  9.     Use IPTR
  10.  
  11.     Revision 1.1  1996/09/11 12:54:45  digulla
  12.     A couple of new DOS functions from M. Fleischer
  13.  
  14.     Desc:
  15.     Lang: english
  16. */
  17. #include <clib/exec_protos.h>
  18. #include <dos/dosextens.h>
  19. #include <dos/filesystem.h>
  20. #include "dos_intern.h"
  21.  
  22. /*****************************************************************************
  23.  
  24.     NAME */
  25.     #include <clib/dos_protos.h>
  26.  
  27.     AROS_LH3(BOOL, Format,
  28.  
  29. /*  SYNOPSIS */
  30.     AROS_LHA(STRPTR, devicename, D1),
  31.     AROS_LHA(STRPTR, volumename, D2),
  32.     AROS_LHA(ULONG,  dostype,    D3),
  33.  
  34. /*  LOCATION */
  35.     struct DosLibrary *, DOSBase, 119, Dos)
  36.  
  37. /*  FUNCTION
  38.  
  39.     INPUTS
  40.  
  41.     RESULT
  42.  
  43.     NOTES
  44.  
  45.     EXAMPLE
  46.  
  47.     BUGS
  48.  
  49.     SEE ALSO
  50.  
  51.     INTERNALS
  52.  
  53.     HISTORY
  54.     29-10-95    digulla automatically created from
  55.                 dos_lib.fd and clib/dos_protos.h
  56.  
  57. *****************************************************************************/
  58. {
  59.     AROS_LIBFUNC_INIT
  60.     AROS_LIBBASE_EXT_DECL(struct DosLibrary *,DOSBase)
  61.  
  62.     /* Get pointer to process structure */
  63.     struct Process *me=(struct Process *)FindTask(NULL);
  64.     struct DosList *dl;
  65.     BOOL success=0;
  66.  
  67.     dl=LockDosList(LDF_DEVICES|LDF_READ);
  68.     dl=FindDosEntry(dl,devicename,LDF_DEVICES);
  69.     if(dl!=NULL)
  70.     {
  71.  
  72.     /* Get pointer to I/O request. Use stackspace for now. */
  73.     struct IOFileSys io,*iofs=&io;
  74.  
  75.     /* Prepare I/O request. */
  76.     iofs->IOFS.io_Message.mn_Node.ln_Type=NT_REPLYMSG;
  77.     iofs->IOFS.io_Message.mn_ReplyPort   =&me->pr_MsgPort;
  78.     iofs->IOFS.io_Message.mn_Length      =sizeof(struct IOFileSys);
  79.     iofs->IOFS.io_Device =dl->dol_Device;
  80.     iofs->IOFS.io_Unit   =dl->dol_Unit;
  81.     iofs->IOFS.io_Command=FSA_FORMAT;
  82.     iofs->IOFS.io_Flags  =0;
  83.     iofs->io_Args[0]=(IPTR)volumename;
  84.     iofs->io_Args[1]=dostype;
  85.  
  86.     /* Send the request. */
  87.     DoIO(&iofs->IOFS);
  88.  
  89.     /* Set error code */
  90.     if(!iofs->io_DosError)
  91.         success=1;
  92.     else
  93.         me->pr_Result2=iofs->io_DosError;
  94.     }else
  95.     me->pr_Result2=ERROR_DEVICE_NOT_MOUNTED;
  96.     /* All Done. */
  97.     UnLockDosList(LDF_DEVICES|LDF_READ);
  98.     return success;
  99.     AROS_LIBFUNC_EXIT
  100. } /* Format */
  101.